<!-- 题库table -->
<script setup lang="ts">
import { defineProps, defineEmits, reactive } from 'vue';
import CardItem from './card-item.vue';
import { delExamQuestionsApi } from "#/api/manage/question-bank"
import { ElMessage } from 'element-plus';
import { $t } from '@vben/locales';

defineOptions({ name: 'Cards' });
const props = defineProps({
  tableList: Array<any>,
  searchKeyword: {
    type: String,
    default: ''
  }
})
const emit = defineEmits(['update:modelValue', 'queryData', 'editItem']);
const delItem = (id: string) => {
  delExamQuestionsApi({ ids: [id], isDeleted: 1 }).then(() => {
    ElMessage.success($t('common.deleteSuccessTxt'))
    emit('queryData')
  })
}

const edit = (row: any) => {
  emit('editItem', row)
}
</script>
<template>
  <div class="card-list pl-[24px] pr-[20px]">
    <CardItem v-for="(item, i) in props.tableList" :indexNumber="i" :item="item" :searchKeyword="props.searchKeyword"
      @del="delItem" @editQuestion="edit"></CardItem>
  </div>
</template>
